gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash ChangeLog gui/Player.cpp gui/Player.h gui...


From: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog gui/Player.cpp gui/Player.h gui...
Date: Wed, 27 Sep 2006 12:52:15 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  06/09/27 12:52:15

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

Log message:
                * server/gnash.h, server/impl.cpp: added set_base_url() and
                  get_base_url() function.
                * gui/Player.{h,cpp}: added setBaseUrl method.
                * gui/gnash.cpp: added -U switch to set base url.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.936&r2=1.937
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/Player.cpp?cvsroot=gnash&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/Player.h?cvsroot=gnash&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/gnash.cpp?cvsroot=gnash&r1=1.44&r2=1.45
http://cvs.savannah.gnu.org/viewcvs/gnash/server/gnash.h?cvsroot=gnash&r1=1.50&r2=1.51
http://cvs.savannah.gnu.org/viewcvs/gnash/server/impl.cpp?cvsroot=gnash&r1=1.56&r2=1.57

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.936
retrieving revision 1.937
diff -u -b -r1.936 -r1.937
--- ChangeLog   27 Sep 2006 11:48:45 -0000      1.936
+++ ChangeLog   27 Sep 2006 12:52:14 -0000      1.937
@@ -1,5 +1,12 @@
 2006-09-27 Sandro Santilli  <address@hidden>
 
+       * server/gnash.h, server/impl.cpp: added set_base_url() and
+         get_base_url() function.
+       * gui/Player.{h,cpp}: added setBaseUrl method.
+       * gui/gnash.cpp: added -U switch to set base url.
+
+2006-09-27 Sandro Santilli  <address@hidden>
+
        * plugin/plugin.cpp: cleanup and use of getCurrentPageURL()
        * plugin/mozilla-sdk/np_entry.cpp, plugin/mozilla-sdk/npn_gate.cpp:
          Added NPN_GetStringIdentifier, NPN_GetProperty and

Index: gui/Player.cpp
===================================================================
RCS file: /sources/gnash/gnash/gui/Player.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- gui/Player.cpp      27 Sep 2006 08:43:54 -0000      1.6
+++ gui/Player.cpp      27 Sep 2006 12:52:15 -0000      1.7
@@ -190,6 +190,14 @@
 #endif
     gnash::register_fscommand_callback(fs_callback);
 
+    // Set base url
+    if ( _baseurl.empty() )
+    {
+       if ( url ) _baseurl = url;
+       else _baseurl = infile;
+    }
+    gnash::set_base_url(URL(_baseurl));
+
     std::auto_ptr<gnash::sound_handler>  sound;
 
     if (do_sound) {

Index: gui/Player.h
===================================================================
RCS file: /sources/gnash/gnash/gui/Player.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- gui/Player.h        23 Sep 2006 15:01:40 -0000      1.1
+++ gui/Player.h        27 Sep 2006 12:52:15 -0000      1.2
@@ -72,6 +72,20 @@
 
        ~Player() {}
 
+       /// Play the movie at the given url/path.
+       //
+       /// @param argc
+       ///     number of argument strings in argv
+       ///
+       /// @param argv
+       ///     argument strings 
+       ///
+       /// @param url
+       ///     an optional url to assign to the given movie.
+       ///     if unspecified the url will be set to the 
+       ///     movie path/url.
+       ///           
+       ///
        int run(int argc, char* argv[],
                const char* infile, const char* url=NULL);
 
@@ -94,6 +108,15 @@
 
        void setDoSound(bool b) { do_sound=b; }
 
+       /// Set the base url for this run.
+       //
+       /// The base url will be used to resolve relative
+       /// urls on load requests.
+       ///
+       void setBaseUrl(const std::string& baseurl) {
+               _baseurl = baseurl;
+       }
+
        float setExitTimeout(float n) {
                float old_timeout = exit_timeout;
                exit_timeout = n;
@@ -139,6 +162,8 @@
        bool do_sound;
 
        float exit_timeout;
+
+       std::string _baseurl;
 };
 
  

Index: gui/gnash.cpp
===================================================================
RCS file: /sources/gnash/gnash/gui/gnash.cpp,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -b -r1.44 -r1.45
--- gui/gnash.cpp       25 Sep 2006 11:35:47 -0000      1.44
+++ gui/gnash.cpp       27 Sep 2006 12:52:15 -0000      1.45
@@ -93,6 +93,8 @@
         "  -b <bits>   Bit depth of output window (16 or 32, default is 16)\n"
         "  -u <url>    Set \"real\" url of the movie\n"
        "              (useful for downloaded movies)\n"
+        "  -U <url>    Set \"base\" url for this run\n"
+       "              (used to resolve relative urls, defaults to movie url)\n"
         "  -P <param>  Set parameter (ie. \"FlashVars=A=1&b=2\")\n"
         "  --version   Print gnash's version number and exit\n"
         "\n"
@@ -145,7 +147,7 @@
         }
     }
     
-    while ((c = getopt (argc, argv, "hvaps:cfd:x:r:t:b:1ewj:k:u:P:")) != -1)
+    while ((c = getopt (argc, argv, "hvaps:cfd:x:r:t:b:1ewj:k:u:P:U:")) != -1)
     {
        switch (c) {
          case 'h':
@@ -183,6 +185,13 @@
               url = optarg;
               dbglogfile << "Setting root URL to: " << url << std::endl;
               break;
+          case 'U':
+         {
+               const char* baseurl = optarg;
+               player.setBaseUrl(baseurl);
+               dbglogfile << "Setting base URL to: " << baseurl << std::endl;
+               break;
+         }
           case 'j':
               player.setWidth ( strtol(optarg, NULL, 0) );
               dbglogfile << "Setting width to: " << player.getWidth() << 
std::endl;

Index: server/gnash.h
===================================================================
RCS file: /sources/gnash/gnash/server/gnash.h,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -b -r1.50 -r1.51
--- server/gnash.h      26 Sep 2006 15:08:06 -0000      1.50
+++ server/gnash.h      27 Sep 2006 12:52:15 -0000      1.51
@@ -120,6 +120,12 @@
 /// before loading or playing any movies!
 DSOEXPORT void set_sound_handler(sound_handler* s);
 
+/// Set the base url against which to resolve relative urls
+DSOEXPORT void set_base_url(const URL& url);
+
+/// Return base url
+DSOEXPORT gnash::URL& get_base_url();
+
 /// You probably don't need this. (@@ make it private?)
 sound_handler* get_sound_handler();
 

Index: server/impl.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/impl.cpp,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -b -r1.56 -r1.57
--- server/impl.cpp     2 Sep 2006 00:37:30 -0000       1.56
+++ server/impl.cpp     27 Sep 2006 12:52:15 -0000      1.57
@@ -79,6 +79,7 @@
 
 #include <string>
 #include <map>
+#include <memory> // for auto_ptr
 
 namespace gnash
 {
@@ -90,8 +91,34 @@
        /// global StreamProvider
        static StreamProvider streamProvider;
 
+       /// Base url (for relative urls resolution)
+       //
+       /// we need an auto_ptr becase the URL class
+       /// is an immutable one and needs to be set 
+       /// at construction time..
+       ///
+       std::auto_ptr<URL> baseurl;
+
 } // namespace gnash::global
 
+void
+set_base_url(const URL& url)
+{
+       // can call this only once during a single run
+       assert(!globals::baseurl.get());
+       globals::baseurl.reset(new URL(url));
+       log_msg("Base url set to: %s", globals::baseurl->str().c_str());
+}
+
+URL&
+get_base_url()
+{
+       // Don't call me if you haven't set me !
+       assert(globals::baseurl.get());
+       return *globals::baseurl;
+}
+
+
 bool   s_verbose_action = false;
 bool   s_verbose_parse = false;
 




reply via email to

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