XMMS2
Main Page
Related Pages
Modules
Data Structures
Files
File List
Globals
src
lib
xmmsvisualization
udp.c
Go to the documentation of this file.
1
#include <stdlib.h>
2
3
#include "
xmmsc/xmmsc_visualization.h
"
4
5
/* helper functions to send/receive upd packages */
6
7
char
*
8
packet_init_data
(
xmmsc_vis_udp_data_t
*p)
9
{
10
char
* buffer = malloc (1 +
sizeof
(uint16_t) +
sizeof
(
xmmsc_vischunk_t
));
11
if
(buffer) {
12
buffer[0] =
'V'
;
13
p->
__unaligned_type
= &buffer[0];
14
p->
__unaligned_grace
= (uint16_t*)&buffer[1];
15
p->
__unaligned_data
= (
xmmsc_vischunk_t
*)&buffer[1 +
sizeof
(uint16_t)];
16
p->
size
= 1 +
sizeof
(uint16_t) +
sizeof
(
xmmsc_vischunk_t
);
17
}
18
return
buffer;
19
}
20
21
char
*
22
packet_init_timing
(
xmmsc_vis_udp_timing_t
*p)
23
{
24
char
* buffer = malloc (1 + 5*
sizeof
(int32_t));
25
if
(buffer) {
26
buffer[0] =
'T'
;
27
p->
__unaligned_type
= &buffer[0];
28
p->
__unaligned_id
= (int32_t*)&buffer[1];
29
p->
__unaligned_clientstamp
= (int32_t*)&buffer[1 +
sizeof
(int32_t)];
30
p->
__unaligned_serverstamp
= (int32_t*)&buffer[1 + 3*
sizeof
(int32_t)];
31
p->
size
= 1 + 5*
sizeof
(int32_t);
32
}
33
return
buffer;
34
}
Generated on Wed Apr 10 2013 22:08:53 for XMMS2 by
1.8.3