[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ./ChangeLog backend/gnash.cpp server/Make...
From: |
Sandro Santilli |
Subject: |
[Gnash-commit] gnash ./ChangeLog backend/gnash.cpp server/Make... |
Date: |
Tue, 16 May 2006 13:56:56 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Branch:
Changes by: Sandro Santilli <address@hidden> 06/05/16 13:56:56
Modified files:
. : ChangeLog
backend : gnash.cpp
server : Makefile.am gnash.h impl.cpp
utilities : processor.cpp
Added files:
server : StreamProvider.cpp StreamProvider.h
Log message:
* backend/gnash.cpp, server/gnash.h,
server/Makefile.am, server/StreamProvider.cpp,
server/StreamProvider.h, server/impl.cpp,
utilities/processor.cpp: removed register_file_opener_callback()
global call, added gnash::globals namespace with streamProvider
default instance for the new StreamProvider class.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/ChangeLog.diff?tr1=1.333&tr2=1.334&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/backend/gnash.cpp.diff?tr1=1.33&tr2=1.34&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/server/Makefile.am.diff?tr1=1.40&tr2=1.41&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/server/StreamProvider.cpp?rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/server/StreamProvider.h?rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/server/gnash.h.diff?tr1=1.24&tr2=1.25&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/server/impl.cpp.diff?tr1=1.39&tr2=1.40&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/utilities/processor.cpp.diff?tr1=1.9&tr2=1.10&r1=text&r2=text
Patches:
Index: gnash/ChangeLog
diff -u gnash/ChangeLog:1.333 gnash/ChangeLog:1.334
--- gnash/ChangeLog:1.333 Tue May 16 12:12:53 2006
+++ gnash/ChangeLog Tue May 16 13:56:56 2006
@@ -1,5 +1,11 @@
2006-05-16 Sandro Santilli <address@hidden>
+ * backend/gnash.cpp, server/gnash.h,
+ server/Makefile.am, server/StreamProvider.cpp,
+ server/StreamProvider.h, server/impl.cpp,
+ utilities/processor.cpp: removed register_file_opener_callback()
+ global call, added gnash::globals namespace with streamProvider
+ default instance for the new StreamProvider class.
* gui/sdlsup.h: don't attempt at including cairo.h
if not using cairo rendered.
* server/swf/ASHandlers.cpp: fixed compiler
Index: gnash/backend/gnash.cpp
diff -u gnash/backend/gnash.cpp:1.33 gnash/backend/gnash.cpp:1.34
--- gnash/backend/gnash.cpp:1.33 Tue May 16 08:05:13 2006
+++ gnash/backend/gnash.cpp Tue May 16 13:56:56 2006
@@ -40,10 +40,6 @@
#include "config.h"
#endif
-#ifdef HAVE_CURL_CURL_H
-#define USE_CURL 1
-#endif
-
#ifdef HAVE_SDL_H
#include "SDL.h"
#include "SDL_thread.h"
@@ -78,10 +74,6 @@
//#include "Movie.h"
#include "movie_definition.h"
#include "URL.h"
-#ifdef USE_CURL
-# include <curl/curl.h>
-# include "curl_adapter.h"
-#endif
#include "GnashException.h"
using namespace std;
@@ -131,35 +123,6 @@
// Define is you just want a hard coded OpenGL graphic
//#define TEST_GRAPHIC
-static tu_file*
-file_opener(const URL& url)
-// Callback function. This opens files for the library.
-{
-// GNASH_REPORT_FUNCTION;
-
- if (url.protocol() == "file")
- {
- std::string path = url.path();
- if ( path == "-" )
- {
- FILE *newin = fdopen(dup(0), "rb");
- return new tu_file(newin, false);
- }
- else
- {
- return new tu_file(path.c_str(), "rb");
- }
- }
- else
- {
-#ifdef USE_CURL
- return curl_adapter::make_stream(url.str().c_str());
-#else
- log_error("Unsupported network connections");
-#endif
- }
-}
-
static void
fs_callback(gnash::movie_interface* movie, const char* command, const char*
args)
// For handling notification callbacks from ActionScript.
@@ -399,7 +362,7 @@
exit(1);
}
- gnash::register_file_opener_callback(file_opener);
+ //gnash::register_file_opener_callback(file_opener);
gnash::register_fscommand_callback(fs_callback);
gnash::sound_handler *sound = NULL;
Index: gnash/server/Makefile.am
diff -u gnash/server/Makefile.am:1.40 gnash/server/Makefile.am:1.41
--- gnash/server/Makefile.am:1.40 Mon May 15 12:50:59 2006
+++ gnash/server/Makefile.am Tue May 16 13:56:56 2006
@@ -151,6 +151,7 @@
sprite_definition.cpp \
sprite_instance.cpp \
stream.cpp \
+ StreamProvider.cpp \
styles.cpp \
tesselate.cpp \
text.cpp \
@@ -204,6 +205,7 @@
sprite_definition.h \
sprite_instance.h \
stream.h \
+ StreamProvider.h \
styles.h \
swf.h \
tesselate.h \
Index: gnash/server/gnash.h
diff -u gnash/server/gnash.h:1.24 gnash/server/gnash.h:1.25
--- gnash/server/gnash.h:1.24 Tue May 16 09:09:24 2006
+++ gnash/server/gnash.h Tue May 16 13:56:56 2006
@@ -123,18 +123,6 @@
/// Signature of file opener callback function
typedef tu_file* (*file_opener_callback)(const URL& url);
-/// Register a callback to the host, for providing a file,
-/// given a "URL" (i.e. a path name). This is the only means
-/// by which the gnash library accesses file data, for
-/// loading movies, cache files, and so on.
-///
-/// gnash will call this when it needs to open a file.
-///
-/// NOTE: the returned tu_file* will be delete'd by gnash
-/// when it is done using it. Your file_opener_function may
-/// return NULL in case the requested file can't be opened.
-void register_file_opener_callback(file_opener_callback opener);
-
/// Signature of progress callback function
typedef void (*progress_callback)(unsigned int loaded_bytes, unsigned int
total_bytes);
@@ -217,8 +205,8 @@
/// disable the attempts to load cache files by calling
/// gnash::use_cache_files(false).
///
-/// Uses the registered file-opener callback to read the files
-/// themselves.
+/// Uses the global StreamProvider 'streamProvider'
+/// to read the files themselves.
///
/// This calls add_ref() on the newly created definition; call
/// drop_ref() when you're done with it.
Index: gnash/server/impl.cpp
diff -u gnash/server/impl.cpp:1.39 gnash/server/impl.cpp:1.40
--- gnash/server/impl.cpp:1.39 Tue May 16 09:09:24 2006
+++ gnash/server/impl.cpp Tue May 16 13:56:56 2006
@@ -76,12 +76,20 @@
#include "swf/tag_loaders.h"
#include "generic_character.h"
#include "URL.h"
+#include "StreamProvider.h"
#include <string>
#include <map>
namespace gnash
{
+
+
+namespace globals { // gnash::globals
+ /// global StreamProvider
+ static StreamProvider streamProvider;
+} // namespace gnash::global
+
bool s_verbose_action = false;
bool s_verbose_parse = false;
@@ -130,20 +138,6 @@
assert(loader_registered);
}
-
-//
-// file_opener callback stuff
-//
-static file_opener_callback s_opener_function = NULL;
-
-void
-register_file_opener_callback(file_opener_callback opener)
- // Host calls this to register a function for opening files,
- // for loading movies.
-{
- s_opener_function = opener;
-}
-
character* character_def::create_character_instance(movie* parent, int id)
// Default. Make a generic_character.
{
@@ -301,13 +295,7 @@
{
//printf("%s: url is %s\n", __PRETTY_FUNCTION__, url.str().c_str());
- if (s_opener_function == NULL) {
- log_error("error: get_movie_info(): no file opener function
registered\n");
- if (version) *version = 0;
- return;
- }
-
- tu_file* in = s_opener_function(url);
+ tu_file* in = globals::streamProvider.getStream(url);
if (in == NULL || in->get_error() != TU_FILE_NO_ERROR) {
log_error("error: get_movie_info(): can't open '%s'\n",
url.str().c_str());
if (version) *version = 0;
@@ -459,15 +447,7 @@
printf("%s: url is %s\n", __PRETTY_FUNCTION__, c_url);
- if (s_opener_function == NULL)
- {
- // Don't even have a way to open the file.
- log_error("error: no file opener function; can't create movie. "
- "See gnash::register_file_opener_callback\n");
- return NULL;
- }
-
- tu_file* in = s_opener_function(url);
+ tu_file* in = globals::streamProvider.getStream(url);
if (in == NULL)
{
log_error("failed to open '%s'; can't create movie.\n", c_url);
@@ -475,7 +455,7 @@
}
else if (in->get_error())
{
- log_error("error: file opener can't open '%s'\n", c_url);
+ log_error("error: streamProvider opener can't open '%s'\n", c_url);
return NULL;
}
Index: gnash/utilities/processor.cpp
diff -u gnash/utilities/processor.cpp:1.9 gnash/utilities/processor.cpp:1.10
--- gnash/utilities/processor.cpp:1.9 Tue May 16 08:05:13 2006
+++ gnash/utilities/processor.cpp Tue May 16 13:56:56 2006
@@ -41,10 +41,6 @@
#include "config.h"
#endif
-#ifdef HAVE_CURL_CURL_H
-#define USE_CURL 1
-#endif
-
#include "tu_file.h"
#include "container.h"
#include "gnash.h"
@@ -53,10 +49,6 @@
#include "movie_interface.h"
#include "log.h"
#include "URL.h"
-#ifdef USE_CURL
-# include <curl/curl.h>
-# include "curl_adapter.h"
-#endif
#include "GnashException.h"
#include <iostream>
@@ -87,36 +79,6 @@
static void usage (const char *);
-static tu_file*
-file_opener(const URL& url)
-// Callback function. This opens files for the library.
-{
-// GNASH_REPORT_FUNCTION;
-
- if (url.protocol() == "file")
- {
- std::string path = url.path();
- if ( path == "-" )
- {
- FILE *newin = fdopen(dup(0), "rb");
- return new tu_file(newin, false);
- }
- else
- {
- return new tu_file(path.c_str(), "rb");
- }
- }
- else
- {
-#ifdef USE_CURL
- return curl_adapter::make_stream(url.str().c_str());
-#else
- log_error("Unsupported network connections");
-#endif
- }
-}
-
-
struct movie_data
{
gnash::movie_definition* m_movie;
@@ -184,7 +146,6 @@
exit(1);
}
- gnash::register_file_opener_callback(file_opener);
gnash::set_use_cache_files(false); // don't load old cache files!
std::vector<movie_data> data;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] gnash ./ChangeLog backend/gnash.cpp server/Make...,
Sandro Santilli <=