gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash ChangeLog server/impl.cpp server/gnash.h


From: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog server/impl.cpp server/gnash.h
Date: Mon, 02 Oct 2006 09:13:21 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  06/10/02 09:13:21

Modified files:
        .              : ChangeLog 
        server         : impl.cpp gnash.h 

Log message:
                * server/impl.cpp, server/gnash.h: exposed a 
create_movie(tu_file*,
                  std::string&) function to let callers use arbitrary data 
sources
                  for movie loading.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.979&r2=1.980
http://cvs.savannah.gnu.org/viewcvs/gnash/server/impl.cpp?cvsroot=gnash&r1=1.58&r2=1.59
http://cvs.savannah.gnu.org/viewcvs/gnash/server/gnash.h?cvsroot=gnash&r1=1.54&r2=1.55

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.979
retrieving revision 1.980
diff -u -b -r1.979 -r1.980
--- ChangeLog   1 Oct 2006 21:32:48 -0000       1.979
+++ ChangeLog   2 Oct 2006 09:13:21 -0000       1.980
@@ -1,3 +1,9 @@
+2006-10-02 Sandro Santilli  <address@hidden>
+
+       * server/impl.cpp, server/gnash.h: exposed a create_movie(tu_file*,
+         std::string&) function to let callers use arbitrary data sources
+         for movie loading.
+
 2006-10-01 Bastiaan Jacques <address@hidden>
 
        * testsuit/libbase/URLTest.cpp: Testcase for bug #17725.

Index: server/impl.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/impl.cpp,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -b -r1.58 -r1.59
--- server/impl.cpp     27 Sep 2006 13:22:00 -0000      1.58
+++ server/impl.cpp     2 Oct 2006 09:13:21 -0000       1.59
@@ -67,6 +67,7 @@
 #include "image.h"
 #include "jpeg.h"
 #include "zlib_adapter.h"
+#include "noseek_fd_adapter.h"
 #include "sprite_definition.h"
 #include "movie_def_impl.h"
 #include "swf.h"
@@ -379,7 +380,7 @@
 // Create a movie_definition from a jpeg stream
 // NOTE: this method assumes this *is* a jpeg stream
 static movie_definition*
-create_jpeg_movie(tu_file* in, const char* /*url*/)
+create_jpeg_movie(tu_file* in, const std::string& /*url*/)
 {
        // FIXME: temporarly disabled
        log_msg("Loading of jpegs unsupported");
@@ -437,7 +438,7 @@
 // Create a movie_definition from an SWF stream
 // NOTE: this method assumes this *is* an SWF stream
 static movie_definition*
-create_swf_movie(tu_file* in, const char* url)
+create_swf_movie(tu_file* in, const std::string& url)
 {
 
        in->set_position(0);
@@ -450,25 +451,9 @@
 }
 
 movie_definition*
-create_movie(const URL& url, const char* reset_url)
+create_movie(tu_file* in, const std::string& url)
 {
-       // URL::str() returns by value, save it to a local string
-       std::string url_str = url.str();
-       const char* c_url = url_str.c_str();
-
-//     printf("%s: url is %s\n",  __PRETTY_FUNCTION__, c_url);
-
-       tu_file* in = globals::streamProvider.getStream(url);
-       if (in == NULL)
-       {
-           log_error("failed to open '%s'; can't create movie.\n", c_url);
-           return NULL;
-       }
-       else if (in->get_error())
-       {
-           log_error("streamProvider opener can't open '%s'\n", c_url);
-           return NULL;
-       }
+       assert(in);
 
        ensure_loaders_registered();
 
@@ -479,11 +464,11 @@
 
        if ( type == "jpeg" )
        {
-               ret = create_jpeg_movie(in, reset_url?reset_url:c_url);
+               ret = create_jpeg_movie(in, url);
        }
        else if ( type == "swf" )
        {
-               ret = create_swf_movie(in, reset_url?reset_url:c_url);
+               ret = create_swf_movie(in, url);
        }
        else
        {
@@ -499,11 +484,39 @@
 
        ret->add_ref();
 
+       return ret;
+}
+
+movie_definition*
+create_movie(const URL& url, const char* reset_url)
+{
+       // URL::str() returns by value, save it to a local string
+       std::string url_str = url.str();
+       const char* c_url = url_str.c_str();
+
+//     printf("%s: url is %s\n",  __PRETTY_FUNCTION__, c_url);
+
+       //tu_file* in = globals::streamProvider.getStream(url);
+       tu_file* in = noseek_fd_adapter::make_stream(fileno(stdin));
+       if (in == NULL)
+       {
+           log_error("failed to open '%s'; can't create movie.\n", c_url);
+           return NULL;
+       }
+       else if (in->get_error())
+       {
+           log_error("streamProvider opener can't open '%s'\n", c_url);
+           return NULL;
+       }
+
+       const char* movie_url = reset_url ? reset_url : c_url;
+       movie_definition* ret = create_movie(in, movie_url);
+
        if (s_use_cache_files)
        {
                // Try to load a .gsc file.
                // WILL NOT WORK FOR NETWORK URLS, would need an hash
-               tu_string       cache_filename(c_url);
+               tu_string       cache_filename(movie_url);
                cache_filename += ".gsc";
                tu_file* cache_in = new tu_file(cache_filename.c_str(), "rb");
                if (cache_in == NULL
@@ -528,6 +541,8 @@
        }
 
        return ret;
+
+
 }
 
 

Index: server/gnash.h
===================================================================
RCS file: /sources/gnash/gnash/server/gnash.h,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -b -r1.54 -r1.55
--- server/gnash.h      29 Sep 2006 04:19:34 -0000      1.54
+++ server/gnash.h      2 Oct 2006 09:13:21 -0000       1.55
@@ -35,7 +35,7 @@
 // 
 //
 
-/* $Id: gnash.h,v 1.54 2006/09/29 04:19:34 nihilus Exp $ */
+/* $Id: gnash.h,v 1.55 2006/10/02 09:13:21 strk Exp $ */
 
 /// \mainpage
 ///
@@ -241,6 +241,16 @@
 ///
 movie_definition* create_movie(const URL& url, const char* real_url=NULL);
 
+/// Load a movie from an already opened stream.
+//
+/// The movie can be both an SWF or JPEG, the url parameter
+/// will be used to set the _url member of the resulting object.
+///
+/// No attempt will be made to load associated .gsc (cache) files
+/// by this function.
+///
+movie_definition* create_movie(tu_file* in, const std::string& url);
+
 /// Creates the movie from the given input stream. 
 //
 /// Only reads from the given stream; does not open files. 




reply via email to

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