[VDPAU] [PATCH] Add a special check for the Opera browser
Anssi Hannula
anssi at mageia.org
Fri Dec 6 04:30:22 PST 2013
05.12.2013 18:47, Jeroen Roovers kirjoitti:
> 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.
Note that opera has "opera:libflashp" in /proc/self/comm which would be
a bit easier to check.
However, konqueror (nspluginviewer) doesn't have anything recognizable
in either /proc/self/cmdline ("/usr/bin/nspluginviewer -dbusservice
org.kde.nspluginviewer-15523") or /proc/self/comm ("nspluginviewer"), so
for that we do need the /proc/self/maps check.
So I'm not opposed to checking /proc/self/maps for opera as well as we
can then use exactly the same code for konqueror as well, this is just a
BTW :)
> ---
> 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)
>
--
Anssi Hannula
More information about the VDPAU
mailing list