From patchwork Sun May 19 06:04:49 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Gaignard X-Patchwork-Id: 17042 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ve0-f198.google.com (mail-ve0-f198.google.com [209.85.128.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 28D1924AAB for ; Sun, 19 May 2013 06:05:38 +0000 (UTC) Received: by mail-ve0-f198.google.com with SMTP id d10sf5155116vea.5 for ; Sat, 18 May 2013 23:04:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:x-beenthere:x-received:received-spf:x-received :x-forwarded-to:x-forwarded-for:delivered-to:x-received:received-spf :mime-version:x-received:date:message-id:subject:from:to:cc :x-gm-message-state:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-google-group-id:list-post:list-help:list-archive:list-unsubscribe :content-type; bh=D9wAY77xk5M1mFy9Rd3kn+ztfC27uwkP0NeIM1iu2hU=; b=ms9wH8y5oP8gf5EDWkmA/UP8vwp0Crx5jQg5P6H3fKHWY93lzKNHZQmSedJ7IF3Dev mUJTZFcb64sdQdppiomWm/Fhd002JiBC8IuSyCm/26DKDUOYUbPk7ye/zhrvUxHQ/Or3 37MQJ6iJ+pTWOpWjD0qCOEquvZFZSDt4gapSgOUCyY/ArD5siE/11bMkTDHSMciJEIDu VtuKgfRKh/8mVaU7CVA5YcW+pNBS+AC6NmcIbBC0m6AuRBeiVBrQY3J+47WYW935FYq3 UC4LJmqEOC3i2xYGMj72D1fwaB6J3HfS9VGVxUuNBiWiyVja3v8KPdHNk4Z1ZJEH39Kd HJ7A== X-Received: by 10.224.215.194 with SMTP id hf2mr31975582qab.0.1368943492386; Sat, 18 May 2013 23:04:52 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.53.102 with SMTP id a6ls1337794qep.59.gmail; Sat, 18 May 2013 23:04:52 -0700 (PDT) X-Received: by 10.52.165.99 with SMTP id yx3mr27166208vdb.34.1368943492170; Sat, 18 May 2013 23:04:52 -0700 (PDT) Received: from mail-vb0-x22d.google.com (mail-vb0-x22d.google.com [2607:f8b0:400c:c02::22d]) by mx.google.com with ESMTPS id j8si9259592vcn.59.2013.05.18.23.04.52 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 18 May 2013 23:04:52 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400c:c02::22d is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=2607:f8b0:400c:c02::22d; Received: by mail-vb0-f45.google.com with SMTP id 12so2336927vbf.32 for ; Sat, 18 May 2013 23:04:52 -0700 (PDT) X-Received: by 10.52.34.114 with SMTP id y18mr4645408vdi.56.1368943491880; Sat, 18 May 2013 23:04:51 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.126.138 with SMTP id c10csp36685vcs; Sat, 18 May 2013 23:04:51 -0700 (PDT) X-Received: by 10.112.158.106 with SMTP id wt10mr24373709lbb.75.1368943490514; Sat, 18 May 2013 23:04:50 -0700 (PDT) Received: from mail-la0-x22a.google.com (mail-la0-x22a.google.com [2a00:1450:4010:c03::22a]) by mx.google.com with ESMTPS id h3si2912882lae.151.2013.05.18.23.04.49 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 18 May 2013 23:04:50 -0700 (PDT) Received-SPF: neutral (google.com: 2a00:1450:4010:c03::22a is neither permitted nor denied by best guess record for domain of benjamin.gaignard@linaro.org) client-ip=2a00:1450:4010:c03::22a; Received: by mail-la0-f42.google.com with SMTP id fg20so3246613lab.29 for ; Sat, 18 May 2013 23:04:49 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.152.87.39 with SMTP id u7mr25740041laz.48.1368943489656; Sat, 18 May 2013 23:04:49 -0700 (PDT) Received: by 10.114.77.74 with HTTP; Sat, 18 May 2013 23:04:49 -0700 (PDT) Date: Sun, 19 May 2013 08:04:49 +0200 Message-ID: Subject: ximagesink: add support for 32-bit RGB with alpha mask From: Benjamin Gaignard To: Benjamin Gaignard Cc: Patch Tracking X-Gm-Message-State: ALoCoQmEdDkG+fXw2pN35c8nueWjynQwXLXh4l3bFrtcOX8JqbxoatMbV6Qee1FEdlqeljLJuDQW X-Original-Sender: benjamin.gaignard@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 2607:f8b0:400c:c02::22d is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , >From 80e700a566cdfe03751a7e48ae7fe3b18d1c6fb6 Mon Sep 17 00:00:00 2001 From: Benjamin Gaignard Date: Thu, 16 May 2013 08:52:29 +0000 Subject: ximagesink: add support for 32-bit RGB with alpha mask When X screen return a depth = 32 with bpp = 32, the alpha mask must be correctly set to have a known GStreamer video format. X visual structure doesn't provide the alpha mask information, but we can find it from the others masks. https://bugzilla.gnome.org/show_bug.cgi?id=700413 --- -- cgit v0.9.0.2-2-gbebe diff --git a/sys/ximage/ximagesink.c b/sys/ximage/ximagesink.c index aaf7223..93fe19d 100644 --- a/sys/ximage/ximagesink.c +++ b/sys/ximage/ximagesink.c @@ -832,6 +832,7 @@ gst_ximagesink_xcontext_get (GstXImageSink * ximagesink) gint nb_formats = 0, i; gint endianness; GstVideoFormat vformat; + guint32 alpha_mask; g_return_val_if_fail (GST_IS_XIMAGESINK (ximagesink), NULL); @@ -904,9 +905,15 @@ gst_ximagesink_xcontext_get (GstXImageSink * ximagesink) GST_DEBUG ("ximagesink is not using XShm extension"); } - vformat = gst_video_format_from_masks (xcontext->depth, xcontext->bpp, - endianness, xcontext->visual->red_mask, xcontext->visual->green_mask, - xcontext->visual->blue_mask, 0); + /* extrapolate alpha mask */ + alpha_mask = ~(xcontext->visual->red_mask + | xcontext->visual->green_mask | xcontext->visual->blue_mask); + alpha_mask &= 0xffffffff; + + vformat = + gst_video_format_from_masks (xcontext->depth, xcontext->bpp, endianness, + xcontext->visual->red_mask, xcontext->visual->green_mask, + xcontext->visual->blue_mask, alpha_mask); if (vformat == GST_VIDEO_FORMAT_UNKNOWN) goto unknown_format;