[VDPAU] [PATCH] Add a special check for the Opera browser

Jeroen Roovers jer at gentoo.org
Thu Dec 5 08:47:53 PST 2013


Let me try again. This time we just check specially for Opera and do
some magic in /proc/self/maps only then. Checked with Opera (naturally)
as well as Firefox, Chrome and Seamonkey.

---
 src/vdpau_wrapper.c | 27 ++++++++++++++++++++++++++-
 1 file changed, 26 insertions(+), 1 deletion(-)

diff --git a/src/vdpau_wrapper.c b/src/vdpau_wrapper.c
index 9932937..c2eff15 100644
--- a/src/vdpau_wrapper.c
+++ b/src/vdpau_wrapper.c
@@ -301,12 +301,14 @@ static void init_running_under_flash(void)
 {
     FILE *fp;
     char buffer[1024];
-    int ret, i;
+    int _running_under_opera = 0, ret, i;
 
+    /* Check for processes that list libflashplayer in argv() */
     fp = fopen("/proc/self/cmdline", "r");
     if (!fp) {
         return;
     }
+
     ret = fread(buffer, 1, sizeof(buffer) - 1, fp);
     fclose(fp);
     if (ret < 0) {
@@ -323,9 +325,32 @@ static void init_running_under_flash(void)
     }
     buffer[ret] = '\0';
 
+    if (strstr(buffer, "operapluginwrapper") != NULL) {
+        _running_under_opera = 1;
+    }
     if (strstr(buffer, "libflashplayer") != NULL) {
         _running_under_flash = 1;
     }
+
+    if(!_running_under_opera) {
+        return;
+    }
+    
+    /* Check for operapluginwrapper which does not list libflashplayer
in argv()
+     * Check maps instead */
+    fp = fopen("/proc/self/maps", "r");
+    if (!fp) {
+        return;
+    }
+
+    while(fgets(buffer, sizeof(buffer), fp)) {
+        if (strstr(buffer, "libflashplayer") != NULL) {
+            _running_under_flash = 1;
+            break;
+        }
+    }
+
+    fclose(fp);
 }
 
 static void init_config(void)
-- 
1.8.3.2



More information about the VDPAU mailing list