summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorphintuka <phintuka>2008-03-16 23:41:37 +0000
committerphintuka <phintuka>2008-03-16 23:41:37 +0000
commit545bd978a9ad74dfe12d5d8ad0cc8ef17a05dc02 (patch)
treee1ab833cb8657628775e6069b315576f63dd95f3
parentcfc5f65595e8a00378431c2eab1e005d81b2003b (diff)
downloadxineliboutput-545bd978a9ad74dfe12d5d8ad0cc8ef17a05dc02.tar.gz
xineliboutput-545bd978a9ad74dfe12d5d8ad0cc8ef17a05dc02.tar.bz2
Byte order cnversion macros for osd_command_t
-rw-r--r--xine_osd_command.h51
1 files changed, 50 insertions, 1 deletions
diff --git a/xine_osd_command.h b/xine_osd_command.h
index f36c387a..bb9956fc 100644
--- a/xine_osd_command.h
+++ b/xine_osd_command.h
@@ -4,7 +4,7 @@
* See the main source file 'xineliboutput.c' for copyright information and
* how to reach the author.
*
- * $Id: xine_osd_command.h,v 1.8 2008-03-11 15:57:57 phintuka Exp $
+ * $Id: xine_osd_command.h,v 1.9 2008-03-16 23:41:37 phintuka Exp $
*
*/
@@ -95,6 +95,55 @@ typedef struct osd_command_s {
} PACKED osd_command_t;
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+# define hton_osdcmd(cmdP) \
+ do { \
+ cmdP.cmd = htonl (cmdP.cmd); \
+ cmdP.wnd = htonl (cmdP.wnd); \
+ cmdP.pts = htonll(cmdP.pts); \
+ cmdP.delay_ms = htonl (cmdP.delay_ms); \
+ cmdP.x = htons (cmdP.x); \
+ cmdP.y = htons (cmdP.y); \
+ cmdP.w = htons (cmdP.w); \
+ cmdP.h = htons (cmdP.h); \
+ cmdP.datalen = htonl (cmdP.datalen); \
+ cmdP.num_rle = htonl (cmdP.num_rle); \
+ cmdP.colors = htonl (cmdP.colors); \
+ cmdP.dirty_area.x1 = htons(cmdP.dirty_area.x1); \
+ cmdP.dirty_area.y1 = htons(cmdP.dirty_area.y1); \
+ cmdP.dirty_area.x2 = htons(cmdP.dirty_area.x2); \
+ cmdP.dirty_area.y2 = htons(cmdP.dirty_area.y2); \
+ } while(0)
+
+# define ntoh_osdcmd(cmdP) \
+ do { \
+ cmdP.cmd = ntohl (cmdP.cmd); \
+ cmdP.wnd = ntohl (cmdP.wnd); \
+ cmdP.pts = ntohll(cmdP.pts); \
+ cmdP.delay_ms = ntohl (cmdP.delay_ms); \
+ cmdP.x = ntohs (cmdP.x); \
+ cmdP.y = ntohs (cmdP.y); \
+ cmdP.w = ntohs (cmdP.w); \
+ cmdP.h = ntohs (cmdP.h); \
+ cmdP.datalen = ntohl (cmdP.datalen); \
+ cmdP.num_rle = ntohl (cmdP.num_rle); \
+ cmdP.colors = ntohl (cmdP.colors); \
+ cmdP.dirty_area.x1 = ntohs(cmdP.dirty_area.x1); \
+ cmdP.dirty_area.y1 = ntohs(cmdP.dirty_area.y1); \
+ cmdP.dirty_area.x2 = ntohs(cmdP.dirty_area.x2); \
+ cmdP.dirty_area.y2 = ntohs(cmdP.dirty_area.y2); \
+ } while(0)
+
+#elif __BYTE_ORDER == __BIG_ENDIAN
+
+# define hton_osdcmd(cmd) do {} while(0)
+# define ntoh_osdcmd(cmd) do {} while(0)
+
+#else
+# error __BYTE_ORDER undefined !
+#endif
+
+
#if defined __cplusplus
}
#endif