[VDPAU] [PATCH] Add detection for multiple flash substrings

Sergey Frolov dunkan.aidaho at gmail.com
Wed Apr 29 08:07:47 PDT 2015


    Flash player library may be named differently than
libflashplayer.so. Additionally some browsers have wrappers that do
not expose library name.

    With this patch user can specify additional substrings to match
against by adding "flash_process=<process_name>" strings into
/etc/vdpau_wrapper.cfg

    Along with "libflashplayer.so" I've added two more:
    * flash-mozilla.so is being used in Debian Multimedia packages
    * operapluginwrapper-native is an Opera's (Presto) wrapper
      process. It's safe to assume that 99% of time the only
      vdpau-enabled software behind it is Adobe Flash.
---
 src/vdpau_wrapper.c   | 15 +++++++++++++--
 src/vdpau_wrapper.cfg |  3 +++
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/src/vdpau_wrapper.c b/src/vdpau_wrapper.c
index 8efbd39..63d858d 100644
--- a/src/vdpau_wrapper.c
+++ b/src/vdpau_wrapper.c
@@ -239,6 +239,7 @@ static void _vdp_close_driver(void)
 static VdpGetProcAddress * _imp_get_proc_address;
 static VdpVideoSurfacePutBitsYCbCr * _imp_vid_put_bits_y_cb_cr;
 static VdpPresentationQueueSetBackgroundColor * _imp_pq_set_bg_color;
+static char _flash_process_signatures[16][64];
 static int _running_under_flash;
 static int _enable_flash_uv_swap = 1;
 static int _disable_flash_pq_bg_color = 1;
@@ -324,6 +325,7 @@ static void init_running_under_flash(void)
 {
     FILE *fp;
     char buffer[1024];
+    char * signature;
     int ret, i;
 
     fp = fopen("/proc/self/cmdline", "r");
@@ -346,8 +348,11 @@ static void init_running_under_flash(void)
     }
     buffer[ret] = '\0';
 
-    if (strstr(buffer, "libflashplayer") != NULL) {
-        _running_under_flash = 1;
+    for (signature = _flash_process_signatures[0]; signature != NULL;
signature++) {
+        if (strstr(buffer, signature) != NULL) {
+            _running_under_flash = 1;
+            break;
+        }
     }
 }
 
@@ -355,12 +360,15 @@ static void init_config(void)
 {
     FILE *fp;
     char buffer[1024];
+    char * signature;
 
     fp = fopen(VDPAU_SYSCONFDIR "/vdpau_wrapper.cfg", "r");
     if (!fp) {
         return;
     }
 
+    signature = _flash_process_signatures[0];
+
     while (fgets(buffer, sizeof(buffer), fp) != NULL) {
         char * equals = strchr(buffer, '=');
         char * param;
@@ -378,6 +386,9 @@ static void init_config(void)
         else if (!strcmp(buffer, "disable_flash_pq_bg_color")) {
             _disable_flash_pq_bg_color = atoi(param);
         }
+        else if (!strcmp(buffer, "flash_process")) {
+            snprintf(signature++, 64, "%s ", param);
+        }
     }
 
     fclose(fp);
diff --git a/src/vdpau_wrapper.cfg b/src/vdpau_wrapper.cfg
index 21d5b8c..bd20fcd 100644
--- a/src/vdpau_wrapper.cfg
+++ b/src/vdpau_wrapper.cfg
@@ -1,2 +1,5 @@
+flash_process=libflashplayer.so
+flash_process=flash-mozilla.so
+flash_process=operapluginwrapper-native
 enable_flash_uv_swap=1
 disable_flash_pq_bg_color=1
-- 
2.1.4


More information about the VDPAU mailing list