[gnome-network-displays] wfd: Correctly handle profiles flags



commit d642047e35dfa7847faad05e0a701eb918d7b53d
Author: Benjamin Berg <bberg redhat com>
Date:   Thu Jan 7 12:52:29 2021 +0100

    wfd: Correctly handle profiles flags
    
    This is a bitfield/flags rather than an enumeration. Change the test
    accordingly and only keep profiles that we know about.

 src/wfd/wfd-video-codec.c | 5 +++--
 src/wfd/wfd-video-codec.h | 1 +
 2 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/src/wfd/wfd-video-codec.c b/src/wfd/wfd-video-codec.c
index c2b3eb3..eb00a57 100644
--- a/src/wfd/wfd-video-codec.c
+++ b/src/wfd/wfd-video-codec.c
@@ -280,11 +280,12 @@ wfd_video_codec_new_from_desc (gint native, const gchar *descr)
   res = wfd_video_codec_new ();
 
   res->profile = (WfdH264ProfileFlags) g_ascii_strtoll (tokens[0], NULL, 16);
-  if (res->profile != WFD_H264_PROFILE_BASE && res->profile != WFD_H264_PROFILE_HIGH)
+  if ((res->profile & WFD_H264_PROFILE_ALL) == 0)
     {
-      g_warning ("Unknown profile 0x%x", res->profile);
+      g_warning ("None of the profiles in 0x%x are supported", res->profile);
       return NULL;
     }
+  res->profile &= WFD_H264_PROFILE_ALL;
 
   res->level = g_ascii_strtoll (tokens[1], NULL, 16);
   if (res->level > 255)
diff --git a/src/wfd/wfd-video-codec.h b/src/wfd/wfd-video-codec.h
index 9f7de23..7682097 100644
--- a/src/wfd/wfd-video-codec.h
+++ b/src/wfd/wfd-video-codec.h
@@ -14,6 +14,7 @@ typedef enum {
   WFD_H264_PROFILE_HIGH = 0x02,
 } WfdH264ProfileFlags;
 
+#define WFD_H264_PROFILE_ALL 0x3
 
 struct _WfdVideoCodec
 {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]