summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim-Philipp Müller <tim@centricular.com>2018-03-17 20:29:35 +0000
committerTim-Philipp Müller <tim@centricular.com>2018-03-17 20:29:35 +0000
commit47ff21ea3b7354925b5741104bd8d22468bccc35 (patch)
treeacb29cf51594f8e558cfc8801dd65b5d63cc2f91
parent65ede0b5651afbdf2ba8358a045daae864a3b24c (diff)
rtpulpfec: fix unconditional use of __attribute__ ((packed))
Fix compilation with MSVC. We still assume that attribute is supported by all other relevant compilers, which seems to be the case since we haven't had any complaints about similar code in rtpsbcpay.
-rw-r--r--gst/rtp/rtpulpfeccommon.h20
1 files changed, 17 insertions, 3 deletions
diff --git a/gst/rtp/rtpulpfeccommon.h b/gst/rtp/rtpulpfeccommon.h
index 6735831b7..2c9d798cc 100644
--- a/gst/rtp/rtpulpfeccommon.h
+++ b/gst/rtp/rtpulpfeccommon.h
@@ -48,6 +48,14 @@ typedef struct {
GstRTPBuffer rtp;
} RtpUlpFecMapInfo;
+/* FIXME: parse/write these properly instead of relying in packed structs */
+#ifdef _MSC_VER
+#pragma pack(push, 1)
+#define ATTRIBUTE_PACKED
+#else
+#define ATTRIBUTE_PACKED __attribute__ ((packed))
+#endif
+
/* RFC 5109 */
/*
0 1 2 3
@@ -76,7 +84,7 @@ typedef struct {
guint16 seq;
guint32 timestamp;
guint16 len;
-} __attribute__ ((packed)) RtpUlpFecHeader;
+} ATTRIBUTE_PACKED RtpUlpFecHeader;
#else
typedef struct {
guint8 E:1;
@@ -91,7 +99,7 @@ typedef struct {
guint16 seq;
guint32 timestamp;
guint16 len;
-} __attribute__ ((packed)) RtpUlpFecHeader;
+} ATTRIBUTE_PACKED RtpUlpFecHeader;
#endif
/*
@@ -110,7 +118,13 @@ typedef struct
guint16 protection_len;
guint16 mask;
guint32 mask_continued;
-} __attribute__ ((packed)) RtpUlpFecLevelHeader;
+} ATTRIBUTE_PACKED RtpUlpFecLevelHeader;
+
+#ifdef _MSC_VER
+#pragma pack(pop)
+#else
+#undef ATTRIBUTE_PACKED
+#endif
gboolean rtp_ulpfec_map_info_map (GstBuffer *buffer, RtpUlpFecMapInfo *info);
void rtp_ulpfec_map_info_unmap (RtpUlpFecMapInfo *info);