[xiph-commits] r3059 - liboggplay/trunk/plugin

shans at svn.annodex.net shans at svn.annodex.net
Tue Jun 26 02:28:07 PDT 2007


Author: shans
Date: 2007-06-26 02:28:07 -0700 (Tue, 26 Jun 2007)
New Revision: 3059

Modified:
   liboggplay/trunk/plugin/plugin.cpp
   liboggplay/trunk/plugin/plugin.h
   liboggplay/trunk/plugin/plugin_oggplay.c
   liboggplay/trunk/plugin/plugin_oggplay.h
Log:
Alternative approach to retrieving proxy



Modified: liboggplay/trunk/plugin/plugin.cpp
===================================================================
--- liboggplay/trunk/plugin/plugin.cpp	2007-06-26 09:02:29 UTC (rev 3058)
+++ liboggplay/trunk/plugin/plugin.cpp	2007-06-26 09:28:07 UTC (rev 3059)
@@ -57,13 +57,10 @@
 
 #include "plugin.h"
 #include "nsIServiceManager.h"
-#include "nsIMemory.h"
 #include "nsISupportsUtils.h" // this is where some useful macros defined
 #if !defined(XP_MACOSX) //temporarily disabled (hopefully)
-#include "necko/nsIProtocolProxyService.h"
-#include "necko/nsIProxyInfo.h"
-#include "nsIProtocolHandler.h"
-#include "nsEmbedString.h"
+#include "nsIPrefService.h"
+#include "nsIPrefBranch.h"
 #endif
 
 #include <npruntime.h>
@@ -243,14 +240,15 @@
 #elif defined (XP_WIN)
   ,
   mPollingStarted(false),
-  mPollingPeriod(POLLING_PERIOD)
+  mPollingPeriod(POLLING_PERIOD),
+  mProxyHost(NULL),
+  mProxyPort(80)
 #endif
 {
 #if !defined(XP_MACOSX) //temporarily disabled (hopefully)
   nsISupports             * sm    = NULL;
-  nsIProtocolProxyService * pps   = NULL;
-  nsIProxyInfo            * pi    = NULL;
-  nsIProtocolHandler      * ph    = NULL;
+  nsIPrefService          * prefs = NULL;
+  nsIPrefBranch           * branch = NULL;
 #endif
 
   mString[0] = '\0';
@@ -268,33 +266,21 @@
   }
 
   if (mServiceManager) {
-
     mServiceManager->GetServiceByContractID(
-        "@mozilla.org/network/protocol-proxy-service;1",
-        NS_GET_IID(nsIProtocolProxyService), (void **)&pps);
-    mServiceManager->GetServiceByContractID(
-        "@mozilla.org/network/protocol;1?name=http",
-        NS_GET_IID(nsIProtocolHandler), (void **)&ph);
+        "@mozilla.org/preferences-service;1",
+        NS_GET_IID(nsIPrefService), (void **)&prefs);
 
   }
-
-  if (pps) {
-    nsIURI    * eguri;
-    nsEmbedCString data("http://example.com");
-
-    ph->NewURI(data, NULL, NULL, &eguri);
-    pps->Resolve(eguri, 0, &pi);
-    printf("pi now %p\n", pi);
+  
+  if (prefs != NULL) {
+    prefs->ReadUserPrefs(nsnull);
+    prefs->GetBranch("network.proxy.", &branch);
   }
 
-  if (pi) {
-    nsEmbedCString host;
-    int            port;
-
-    pi->GetHost(host);
-    pi->GetPort(&port);
-    printf("proxy host is %s\n", host.get());
-    printf("proxy port is %d\n", port);
+  if (branch != NULL) {
+    char *host = NULL;
+    branch->GetCharPref("http", &host);
+    printf("host is %s\n", host);
   }
 #endif
 
@@ -898,3 +884,4 @@
 }
 } // extern "C"
 
+

Modified: liboggplay/trunk/plugin/plugin.h
===================================================================
--- liboggplay/trunk/plugin/plugin.h	2007-06-26 09:02:29 UTC (rev 3058)
+++ liboggplay/trunk/plugin/plugin.h	2007-06-26 09:28:07 UTC (rev 3059)
@@ -148,6 +148,9 @@
   semaphore                   mEndPlaySem;
   semaphore                   mPlaylistSem;
 
+  char                      * mProxyHost;
+  int                       * mProxyPort;
+
 #if defined(XP_WIN)
   WNDPROC             lpOldProc;
   bool                mPollingStarted;

Modified: liboggplay/trunk/plugin/plugin_oggplay.c
===================================================================
--- liboggplay/trunk/plugin/plugin_oggplay.c	2007-06-26 09:02:29 UTC (rev 3058)
+++ liboggplay/trunk/plugin/plugin_oggplay.c	2007-06-26 09:28:07 UTC (rev 3059)
@@ -519,7 +519,7 @@
   return pointers->last_displayed_frame_time;
 }
 
-bool
+int
 set_oggplay_play_position(void *handle, long milliseconds) {
 
   PluginPointers *pointers = (PluginPointers *)handle;

Modified: liboggplay/trunk/plugin/plugin_oggplay.h
===================================================================
--- liboggplay/trunk/plugin/plugin_oggplay.h	2007-06-26 09:02:29 UTC (rev 3058)
+++ liboggplay/trunk/plugin/plugin_oggplay.h	2007-06-26 09:28:07 UTC (rev 3059)
@@ -86,7 +86,7 @@
 long
 get_oggplay_play_position(void *handle);
 
-bool
+int
 set_oggplay_play_position(void *handle, long milliseconds);
 
 int get_audio_rate(void *ptrs);



More information about the commits mailing list