[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog libbase/Makefile.am libbase/cur...
From: |
Tomas Groth |
Subject: |
[Gnash-commit] gnash ChangeLog libbase/Makefile.am libbase/cur... |
Date: |
Fri, 09 Mar 2007 14:38:29 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Tomas Groth <tgc> 07/03/09 14:38:29
Modified files:
. : ChangeLog
libbase : Makefile.am curl_adapter.cpp
noseek_fd_adapter.cpp tu_file.cpp tu_file.h
zlib_adapter.cpp
server/asobj : NetConnection.cpp NetConnection.h NetStream.cpp
NetStream.h NetStreamFfmpeg.cpp
NetStreamFfmpeg.h Sound.cpp Sound.h
SoundFfmpeg.cpp SoundFfmpeg.h
Added files:
libbase : LoadThread.cpp LoadThread.h
Log message:
* libbase/LoadThread.{h,cpp}: Added implementation of a download thread.
* libbase/Makefile.am: Included LoadThread.{h,cpp}.
* libbase/curl_adapter.cpp, libbase/noseek_fd_adapter.cpp,
libbase/tu_file.{h,cpp}, libbase/zlib_adapter.cpp: Removed
get_cur_stream_size(), instead used LoadThread::getBytesLoaded().
* server/asobj/NetConnection.cpp: Use LoadThread.
* server/asobj/NetStream.{h,cpp}, server/asobj/NetStreamFfmpeg.{h,cpp},
server/asobj/Sound.{h,cpp}, server/asobj/SoundFfmpeg.{h,cpp}: Fixed
compilation with newer FFMPEG versions.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.2589&r2=1.2590
http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/Makefile.am?cvsroot=gnash&r1=1.59&r2=1.60
http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/curl_adapter.cpp?cvsroot=gnash&r1=1.23&r2=1.24
http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/noseek_fd_adapter.cpp?cvsroot=gnash&r1=1.13&r2=1.14
http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/tu_file.cpp?cvsroot=gnash&r1=1.12&r2=1.13
http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/tu_file.h?cvsroot=gnash&r1=1.10&r2=1.11
http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/zlib_adapter.cpp?cvsroot=gnash&r1=1.12&r2=1.13
http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/LoadThread.cpp?cvsroot=gnash&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/LoadThread.h?cvsroot=gnash&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/NetConnection.cpp?cvsroot=gnash&r1=1.27&r2=1.28
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/NetConnection.h?cvsroot=gnash&r1=1.19&r2=1.20
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/NetStream.cpp?cvsroot=gnash&r1=1.28&r2=1.29
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/NetStream.h?cvsroot=gnash&r1=1.21&r2=1.22
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/NetStreamFfmpeg.cpp?cvsroot=gnash&r1=1.20&r2=1.21
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/NetStreamFfmpeg.h?cvsroot=gnash&r1=1.13&r2=1.14
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/Sound.cpp?cvsroot=gnash&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/Sound.h?cvsroot=gnash&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/SoundFfmpeg.cpp?cvsroot=gnash&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/SoundFfmpeg.h?cvsroot=gnash&r1=1.1&r2=1.2
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.2589
retrieving revision 1.2590
diff -u -b -r1.2589 -r1.2590
--- ChangeLog 9 Mar 2007 13:55:50 -0000 1.2589
+++ ChangeLog 9 Mar 2007 14:38:28 -0000 1.2590
@@ -1,3 +1,15 @@
+2007-03-09 Tomas Groth Christensen <address@hidden>
+
+ * libbase/LoadThread.{h,cpp}: Added implementation of a download thread.
+ * libbase/Makefile.am: Included LoadThread.{h,cpp}.
+ * libbase/curl_adapter.cpp, libbase/noseek_fd_adapter.cpp,
+ libbase/tu_file.{h,cpp}, libbase/zlib_adapter.cpp: Removed
+ get_cur_stream_size(), instead used LoadThread::getBytesLoaded().
+ * server/asobj/NetConnection.cpp: Use LoadThread.
+ * server/asobj/NetStream.{h,cpp}, server/asobj/NetStreamFfmpeg.{h,cpp},
+ server/asobj/Sound.{h,cpp}, server/asobj/SoundFfmpeg.{h,cpp}: Fixed
+ compilation with newer FFMPEG versions.
+
2007-03-09 Sandro Santilli <address@hidden>
* server/asobj/xmlsocket.cpp: use call_method() and call_method0()
Index: libbase/Makefile.am
===================================================================
RCS file: /sources/gnash/gnash/libbase/Makefile.am,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -b -r1.59 -r1.60
--- libbase/Makefile.am 6 Mar 2007 18:06:12 -0000 1.59
+++ libbase/Makefile.am 9 Mar 2007 14:38:29 -0000 1.60
@@ -95,7 +95,8 @@
noseek_fd_adapter.cpp \
zlib_adapter.cpp \
Thread.cpp \
- URL.cpp
+ URL.cpp \
+ LoadThread.cpp
noinst_HEADERS = \
@@ -134,7 +135,8 @@
noseek_fd_adapter.h \
zlib_adapter.h \
Thread.h \
- URL.h
+ URL.h \
+ LoadThread.h
if USE_SOUND_GST
libgnashbase_la_SOURCES += gstgnashsrc.c embedVideoDecoderGst.cpp
Index: libbase/curl_adapter.cpp
===================================================================
RCS file: /sources/gnash/gnash/libbase/curl_adapter.cpp,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -b -r1.23 -r1.24
--- libbase/curl_adapter.cpp 4 Mar 2007 21:35:31 -0000 1.23
+++ libbase/curl_adapter.cpp 9 Mar 2007 14:38:29 -0000 1.24
@@ -16,7 +16,7 @@
//
-/* $Id: curl_adapter.cpp,v 1.23 2007/03/04 21:35:31 tgc Exp $ */
+/* $Id: curl_adapter.cpp,v 1.24 2007/03/09 14:38:29 tgc Exp $ */
#if defined(_WIN32) || defined(WIN32)
#define snprintf _snprintf
@@ -128,8 +128,6 @@
/// Returns the size of the stream
long get_stream_size();
- /// Returns the size of the cached part of the stream
- long get_cur_stream_size();
private:
void init(const std::string& url);
@@ -529,18 +527,6 @@
}
-/*public*/
-long
-CurlStreamFile::get_cur_stream_size()
-{
-
-#ifdef GNASH_CURL_VERBOSE
- fprintf(stderr, "get_cur_stream_size() returning %ld\n", _cached);
-#endif
-
- return _cached;
-
-}
/***********************************************************************
*
* Adapter calls
@@ -601,14 +587,6 @@
}
-static long
-get_cur_stream_size(void* appdata)
-{
- CurlStreamFile* stream = (CurlStreamFile*) appdata;
- return stream->get_cur_stream_size();
-
-}
-
static int
close(void* appdata)
{
@@ -652,7 +630,6 @@
tell, // tell
eof, // get eof
get_stream_size, // size of stream
- get_cur_stream_size, // current size of cached stream
close);
}
@@ -684,7 +661,6 @@
tell, // tell
eof, // get eof
get_stream_size, // size of stream
- get_cur_stream_size, // current size of cached stream
close);
}
Index: libbase/noseek_fd_adapter.cpp
===================================================================
RCS file: /sources/gnash/gnash/libbase/noseek_fd_adapter.cpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- libbase/noseek_fd_adapter.cpp 4 Mar 2007 21:35:31 -0000 1.13
+++ libbase/noseek_fd_adapter.cpp 9 Mar 2007 14:38:29 -0000 1.14
@@ -16,7 +16,7 @@
//
-/* $Id: noseek_fd_adapter.cpp,v 1.13 2007/03/04 21:35:31 tgc Exp $ */
+/* $Id: noseek_fd_adapter.cpp,v 1.14 2007/03/09 14:38:29 tgc Exp $ */
#if defined(_WIN32) || defined(WIN32)
#define snprintf _snprintf
@@ -490,7 +490,6 @@
tell, // tell
eof, // get eof
NULL, // get stream size
- NULL, // get cur stream size
close);
}
Index: libbase/tu_file.cpp
===================================================================
RCS file: /sources/gnash/gnash/libbase/tu_file.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- libbase/tu_file.cpp 4 Mar 2007 21:35:31 -0000 1.12
+++ libbase/tu_file.cpp 9 Mar 2007 14:38:29 -0000 1.13
@@ -319,7 +319,7 @@
// Create a file using the custom callbacks.
tu_file::tu_file(void * appdata, read_func rf, write_func wf,
seek_func sf, seek_to_end_func ef, tell_func tf,
- get_eof_func gef, get_stream_size_func gss,
get_cur_stream_size_func gcss, close_func cf)
+ get_eof_func gef, get_stream_size_func gss, close_func cf)
{
m_data = appdata;
m_read = rf;
@@ -329,7 +329,6 @@
m_tell = tf;
m_get_eof = gef;
m_get_stream_size = gss;
- m_get_cur_stream_size = gcss;
m_close = cf;
m_error = TU_FILE_NO_ERROR;
}
@@ -347,7 +346,6 @@
m_tell = std_tell_func;
m_get_eof = std_get_eof_func;
m_get_stream_size = std_get_stream_size_func;
- m_get_cur_stream_size = std_get_stream_size_func;
m_close = autoclose ? std_close_func : NULL;
m_error = TU_FILE_NO_ERROR;
}
@@ -367,7 +365,6 @@
m_tell = std_tell_func;
m_get_eof = std_get_eof_func;
m_get_stream_size = std_get_stream_size_func;
- m_get_cur_stream_size = std_get_stream_size_func;
m_close = std_close_func;
m_error = TU_FILE_NO_ERROR;
} else {
@@ -378,7 +375,6 @@
m_tell = NULL;
m_get_eof = NULL;
m_get_stream_size = NULL;
- m_get_cur_stream_size = NULL;
m_close = NULL;
m_error = TU_FILE_OPEN_ERROR;
}
@@ -396,7 +392,6 @@
m_tell = mem_tell_func;
m_get_eof = mem_get_eof_func;
m_get_stream_size = mem_get_stream_size;
- m_get_cur_stream_size = mem_get_stream_size;
m_close = mem_close_func;
m_error = TU_FILE_NO_ERROR;
}
@@ -414,7 +409,6 @@
m_tell = mem_tell_func;
m_get_eof = mem_get_eof_func;
m_get_stream_size = mem_get_stream_size;
- m_get_cur_stream_size = mem_get_stream_size;
m_close = mem_close_func;
m_error = TU_FILE_NO_ERROR;
}
Index: libbase/tu_file.h
===================================================================
RCS file: /sources/gnash/gnash/libbase/tu_file.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- libbase/tu_file.h 4 Mar 2007 21:35:31 -0000 1.10
+++ libbase/tu_file.h 9 Mar 2007 14:38:29 -0000 1.11
@@ -44,7 +44,6 @@
typedef int (* tell_func)(void* appdata);
typedef bool (* get_eof_func)(void* appdata);
typedef long (* get_stream_size_func)(void* appdata);
- typedef long (* get_cur_stream_size_func)(void* appdata);
typedef int (* close_func)(void* appdata);
// The generic constructor; supply functions for the implementation.
@@ -57,7 +56,6 @@
tell_func tf,
get_eof_func gef,
get_stream_size_func gss,
- get_cur_stream_size_func gcss,
close_func cf=NULL);
// Make a file from an ordinary FILE*.
@@ -139,7 +137,6 @@
// get the size of the stream
int get_size() { return m_get_stream_size(m_data); }
- int get_cur_size() { return m_get_cur_stream_size(m_data); }
// printf-style convenience function.
int printf(const char* fmt, ...);
@@ -193,7 +190,6 @@
tell_func m_tell;
get_eof_func m_get_eof;
get_stream_size_func m_get_stream_size;
- get_cur_stream_size_func m_get_cur_stream_size;
close_func m_close;
int m_error;
};
Index: libbase/zlib_adapter.cpp
===================================================================
RCS file: /sources/gnash/gnash/libbase/zlib_adapter.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- libbase/zlib_adapter.cpp 4 Mar 2007 21:35:31 -0000 1.12
+++ libbase/zlib_adapter.cpp 9 Mar 2007 14:38:29 -0000 1.13
@@ -323,7 +323,6 @@
inflate_tell,
inflate_get_eof,
NULL, // get stream size
- NULL, // get cur stream size
inflate_close)
);
}
Index: server/asobj/NetConnection.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/NetConnection.cpp,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -b -r1.27 -r1.28
--- server/asobj/NetConnection.cpp 4 Mar 2007 21:35:31 -0000 1.27
+++ server/asobj/NetConnection.cpp 9 Mar 2007 14:38:29 -0000 1.28
@@ -14,7 +14,7 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-/* $Id: NetConnection.cpp,v 1.27 2007/03/04 21:35:31 tgc Exp $ */
+/* $Id: NetConnection.cpp,v 1.28 2007/03/09 14:38:29 tgc Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -56,7 +56,7 @@
as_object(getNetConnectionInterface()),
_url(),
_owner(NULL),
- _stream(NULL)
+ _loader(NULL)
{
}
@@ -77,7 +77,7 @@
{
// if already running there is no need to setup things again
- if (_stream) return true;
+ if (_loader) return true;
_owner = owner;
if (_url.size() > 0) {
@@ -95,9 +95,7 @@
return false;
}
- _stream = StreamProvider::getDefaultInstance().getStream(uri);
-
- if (!_stream) return false;
+ _loader = new
LoadThread(StreamProvider::getDefaultInstance().getStream(uri));
return true;
}
@@ -116,39 +114,29 @@
NetConnection::eof()
{
- if (!_stream) return false;
-
- return _stream->get_eof();
+ return _loader->eof();
}
/*public*/
size_t
NetConnection::read(void *dst, size_t bytes)
{
- if (!_stream) return 0;
-
- return _stream->read_bytes(dst, bytes);
+ return _loader->read(dst, bytes);
}
/*public*/
bool
NetConnection::seek(size_t pos)
{
- if (!_stream) return false;
-
- _stream->set_position(pos);
+ return _loader->seek(pos);
- if (_stream->get_position() == pos) return true;
- else return false;
}
/*public*/
size_t
NetConnection::tell()
{
- if (!_stream) return 0;
-
- return _stream->get_position();
+ return _loader->tell();
}
@@ -156,9 +144,7 @@
long
NetConnection::getBytesLoaded()
{
- if (!_stream) return -1;
-
- return _stream->get_cur_size();
+ return _loader->getBytesLoaded();
}
@@ -166,9 +152,7 @@
long
NetConnection::getBytesTotal()
{
- if (!_stream) return -1;
-
- return _stream->get_size();
+ return _loader->getBytesLoaded();
}
Index: server/asobj/NetConnection.h
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/NetConnection.h,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -b -r1.19 -r1.20
--- server/asobj/NetConnection.h 4 Mar 2007 21:35:31 -0000 1.19
+++ server/asobj/NetConnection.h 9 Mar 2007 14:38:29 -0000 1.20
@@ -14,7 +14,7 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-/* $Id: NetConnection.h,v 1.19 2007/03/04 21:35:31 tgc Exp $ */
+/* $Id: NetConnection.h,v 1.20 2007/03/09 14:38:29 tgc Exp $ */
#ifndef __NETCONNECTION_H__
#define __NETCONNECTION_H__
@@ -24,6 +24,7 @@
#endif
#include "tu_file.h"
+#include "LoadThread.h"
#include <stdexcept>
#include <cstdio>
@@ -87,8 +88,8 @@
/// the as_object which owns the connection
as_object* _owner;
- /// The file connection
- tu_file* _stream;
+ /// The file/stream loader thread and interface
+ LoadThread* _loader;
};
void netconnection_class_init(as_object& global);
Index: server/asobj/NetStream.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/NetStream.cpp,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -b -r1.28 -r1.29
--- server/asobj/NetStream.cpp 4 Mar 2007 21:35:31 -0000 1.28
+++ server/asobj/NetStream.cpp 9 Mar 2007 14:38:29 -0000 1.29
@@ -15,19 +15,20 @@
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//
-/* $Id: NetStream.cpp,v 1.28 2007/03/04 21:35:31 tgc Exp $ */
+/* $Id: NetStream.cpp,v 1.29 2007/03/09 14:38:29 tgc Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
+#include "NetStream.h"
+
#include "log.h"
#ifdef SOUND_GST
# include "NetStreamGst.h"
#elif defined(USE_FFMPEG)
# include "NetStreamFfmpeg.h"
#endif
-#include "NetStream.h"
#include "fn_call.h"
#include "builtin_function.h"
#include "GnashException.h"
Index: server/asobj/NetStream.h
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/NetStream.h,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -b -r1.21 -r1.22
--- server/asobj/NetStream.h 4 Mar 2007 21:35:31 -0000 1.21
+++ server/asobj/NetStream.h 9 Mar 2007 14:38:29 -0000 1.22
@@ -18,7 +18,7 @@
//
//
-/* $Id: NetStream.h,v 1.21 2007/03/04 21:35:31 tgc Exp $ */
+/* $Id: NetStream.h,v 1.22 2007/03/09 14:38:29 tgc Exp $ */
#ifndef __NETSTREAM_H__
#define __NETSTREAM_H__
@@ -27,8 +27,10 @@
#include "config.h"
#endif
-#include <queue>
-#include <pthread.h>
+#ifndef __STDC_CONSTANT_MACROS
+#define __STDC_CONSTANT_MACROS
+#endif
+
#include "impl.h"
#include "video_stream_instance.h"
Index: server/asobj/NetStreamFfmpeg.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/NetStreamFfmpeg.cpp,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -b -r1.20 -r1.21
--- server/asobj/NetStreamFfmpeg.cpp 4 Mar 2007 21:35:31 -0000 1.20
+++ server/asobj/NetStreamFfmpeg.cpp 9 Mar 2007 14:38:29 -0000 1.21
@@ -1,5 +1,5 @@
//
-// Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+// Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -14,7 +14,7 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-/* $Id: NetStreamFfmpeg.cpp,v 1.20 2007/03/04 21:35:31 tgc Exp $ */
+/* $Id: NetStreamFfmpeg.cpp,v 1.21 2007/03/09 14:38:29 tgc Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -22,8 +22,8 @@
#ifdef USE_FFMPEG
-#include "log.h"
#include "NetStreamFfmpeg.h"
+#include "log.h"
#include "fn_call.h"
#include "NetStream.h"
#include "render.h"
@@ -31,8 +31,6 @@
#include "NetConnection.h"
#include "sound_handler.h"
-#include "tu_file.h"
-
#if defined(_WIN32) || defined(WIN32)
#include <Windows.h> // for sleep()
#define usleep(x) Sleep(x/1000)
@@ -207,7 +205,7 @@
return 0;
}
- // Does it have an associated NetConnectoin ?
+ // Does it have an associated NetConnection ?
if ( ! _netCon )
{
IF_VERBOSE_ASCODING_ERRORS(
@@ -326,9 +324,10 @@
ns->m_video_stream =
ns->m_FormatCtx->streams[i];
}
break;
- case CODEC_TYPE_DATA:
+ /*case CODEC_TYPE_DATA:
case CODEC_TYPE_SUBTITLE:
- case CODEC_TYPE_UNKNOWN:
+ case CODEC_TYPE_UNKNOWN:*/
+ default:
break;
}
}
@@ -748,6 +747,7 @@
int64_t
NetStreamFfmpeg::time()
{
+
if (m_FormatCtx && m_FormatCtx->nb_streams > 0) {
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<int64_t>(time);
Index: server/asobj/NetStreamFfmpeg.h
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/NetStreamFfmpeg.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- server/asobj/NetStreamFfmpeg.h 4 Mar 2007 21:35:31 -0000 1.13
+++ server/asobj/NetStreamFfmpeg.h 9 Mar 2007 14:38:29 -0000 1.14
@@ -14,7 +14,7 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-/* $Id: NetStreamFfmpeg.h,v 1.13 2007/03/04 21:35:31 tgc Exp $ */
+/* $Id: NetStreamFfmpeg.h,v 1.14 2007/03/09 14:38:29 tgc Exp $ */
#ifndef __NETSTREAMFFMPEG_H__
#define __NETSTREAMFFMPEG_H__
@@ -25,6 +25,10 @@
#ifdef USE_FFMPEG
+#ifndef __STDC_CONSTANT_MACROS
+#define __STDC_CONSTANT_MACROS
+#endif
+
#include <queue>
#include <boost/thread/thread.hpp>
#include <boost/bind.hpp>
@@ -32,7 +36,9 @@
#include "impl.h"
#include "video_stream_instance.h"
+
#include <ffmpeg/avformat.h>
+
#include "image.h"
#include "StreamProvider.h"
#include "NetStream.h" // for inheritance
Index: server/asobj/Sound.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/Sound.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- server/asobj/Sound.cpp 4 Mar 2007 02:00:42 -0000 1.6
+++ server/asobj/Sound.cpp 9 Mar 2007 14:38:29 -0000 1.7
@@ -20,8 +20,8 @@
#include "config.h"
#endif
-#include "log.h"
#include "Sound.h"
+#include "log.h"
#include "sound_definition.h" // for sound_sample
#include "movie_definition.h"
#include "sprite_instance.h"
Index: server/asobj/Sound.h
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/Sound.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- server/asobj/Sound.h 14 Feb 2007 20:41:48 -0000 1.2
+++ server/asobj/Sound.h 9 Mar 2007 14:38:29 -0000 1.3
@@ -23,6 +23,10 @@
#include "config.h"
#endif
+#ifndef __STDC_CONSTANT_MACROS
+#define __STDC_CONSTANT_MACROS
+#endif
+
#include "impl.h"
#include "as_object.h" // for inheritance
#include "NetConnection.h"
Index: server/asobj/SoundFfmpeg.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/SoundFfmpeg.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- server/asobj/SoundFfmpeg.cpp 27 Feb 2007 09:10:20 -0000 1.4
+++ server/asobj/SoundFfmpeg.cpp 9 Mar 2007 14:38:29 -0000 1.5
@@ -20,8 +20,8 @@
#include "config.h"
#endif
-#include "log.h"
#include "SoundFfmpeg.h"
+#include "log.h"
#include "sound_definition.h" // for sound_sample
#include "movie_definition.h"
#include "sprite_instance.h"
Index: server/asobj/SoundFfmpeg.h
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/SoundFfmpeg.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- server/asobj/SoundFfmpeg.h 14 Feb 2007 20:41:48 -0000 1.1
+++ server/asobj/SoundFfmpeg.h 9 Mar 2007 14:38:29 -0000 1.2
@@ -23,6 +23,10 @@
#include "config.h"
#endif
+#ifndef __STDC_CONSTANT_MACROS
+#define __STDC_CONSTANT_MACROS
+#endif
+
#include "impl.h"
#include "as_object.h"
#include "NetConnection.h"
Index: libbase/LoadThread.cpp
===================================================================
RCS file: libbase/LoadThread.cpp
diff -N libbase/LoadThread.cpp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ libbase/LoadThread.cpp 9 Mar 2007 14:38:29 -0000 1.1
@@ -0,0 +1,148 @@
+//
+// Copyright (C) 2007 Free Software Foundation, Inc.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+//
+
+// $Id: LoadThread.cpp,v 1.1 2007/03/09 14:38:29 tgc Exp $
+
+#include "LoadThread.h"
+
+LoadThread::LoadThread(tu_file* stream)
+ :
+ _stream(stream),
+ _bytesLoaded(0),
+ _completed(false),
+ _loadPosition(0),
+ _userPosition(0),
+ _actualPosition(0)
+{
+
+ // Start the downloading.
+ _thread.reset( new
boost::thread(boost::bind(LoadThread::downloadThread, this)) );
+}
+
+
+LoadThread::~LoadThread()
+{
+ // stop the download thread if it's still runnning
+ completed();
+}
+
+bool LoadThread::seek(size_t pos)
+{
+ // Try to seek to the wanted position, and return
+ // true is the new position is equal the wanted,
+ // or else return false
+
+ boost::mutex::scoped_lock lock(_mutex);
+ _stream->set_position(pos);
+ unsigned int ret = _stream->get_position();
+ _userPosition = ret;
+ _actualPosition = _userPosition;
+ return (pos == ret);
+}
+
+size_t LoadThread::read(void *dst, size_t bytes)
+{
+
+ boost::mutex::scoped_lock lock(_mutex);
+
+ // If the actual position is different from the position
+ // last used by the user/owner, seek to the position
+ if (_actualPosition != _userPosition) {
+ _stream->set_position(_userPosition);
+ _actualPosition = _userPosition;
+ }
+
+ // Try to read a wanted amount of bytes into the given
+ // buffer, note the new position and return the actual amount read
+ int ret = _stream->read_bytes(dst, bytes);
+ _userPosition += ret;
+ _actualPosition = _userPosition;
+ return ret;
+}
+
+bool LoadThread::eof()
+{
+ boost::mutex::scoped_lock lock(_mutex);
+
+ // If the actual position is different from the position
+ // last used by the user/owner, seek to the position
+ if (_actualPosition != _userPosition) {
+ _stream->set_position(_userPosition);
+ _actualPosition = _userPosition;
+ }
+
+ // Check if we're at the EOF
+ return _stream->get_eof();
+
+}
+
+size_t LoadThread::tell()
+{
+
+ boost::mutex::scoped_lock lock(_mutex);
+ return _userPosition;
+}
+
+long LoadThread::getBytesLoaded()
+{
+ boost::mutex::scoped_lock lock(_mutex);
+
+ // The load position is equal to the bytesloaded
+ return _loadPosition;
+}
+
+long LoadThread::getBytesTotal()
+{
+ boost::mutex::scoped_lock lock(_mutex);
+ return _stream->get_size();
+}
+
+bool LoadThread::completed()
+{
+ boost::mutex::scoped_lock lock(_mutex);
+ if ( _completed && _thread.get() )
+ {
+ _thread->join();
+ }
+
+ return _completed;
+}
+
+void LoadThread::downloadThread(LoadThread* lt)
+{
+
+ // Until the download is completed keep downloading
+ while (!lt->_completed) {
+ lt->download();
+ }
+
+}
+
+void LoadThread::download()
+{
+ boost::mutex::scoped_lock lock(_mutex);
+ size_t CHUNK_SIZE = 1024;
+ _stream->set_position(_loadPosition + CHUNK_SIZE);
+
+ unsigned int pos = _stream->get_position();
+ if (pos != _loadPosition + CHUNK_SIZE) {
+ _completed = true;
+ }
+ _loadPosition = pos;
+ _actualPosition = pos;
+}
Index: libbase/LoadThread.h
===================================================================
RCS file: libbase/LoadThread.h
diff -N libbase/LoadThread.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ libbase/LoadThread.h 9 Mar 2007 14:38:29 -0000 1.1
@@ -0,0 +1,79 @@
+//
+// Copyright (C) 2007 Free Software Foundation, Inc.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+//
+
+// $Id: LoadThread.h,v 1.1 2007/03/09 14:38:29 tgc Exp $
+#include <boost/thread/thread.hpp>
+#include <boost/thread/mutex.hpp>
+#include <boost/bind.hpp>
+
+#include "tu_file.h"
+#include <memory>
+
+class LoadThread
+{
+
+public:
+ LoadThread(tu_file* stream);
+ ~LoadThread();
+
+ /// Put read pointer at given position
+ bool seek(size_t pos);
+
+ /// Read 'bytes' bytes into the given buffer.
+ /// Return number of actually read bytes
+ size_t read(void *dst, size_t bytes);
+
+ /// Return true if EOF has been reached
+ bool eof();
+
+ /// Report global position within the file
+ size_t tell();
+
+ /// Returns the number of bytes cached
+ long getBytesLoaded();
+
+ /// Returns the total size of the file
+ long getBytesTotal();
+
+ /// Check if the load is completed
+ bool completed();
+
+private:
+
+ /// The thread function used to download from the stream
+ static void downloadThread(LoadThread* lt);
+
+ /// The function that does the actual downloading
+ void download();
+
+ /// The stream/file we want to access
+ std::auto_ptr<tu_file> _stream;
+
+ long _bytesLoaded;
+
+ bool _completed;
+
+ boost::mutex _mutex;
+
+ std::auto_ptr<boost::thread> _thread;
+
+ long _loadPosition;
+ long _userPosition;
+ long _actualPosition;
+};
+
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] gnash ChangeLog libbase/Makefile.am libbase/cur...,
Tomas Groth <=