Mercurial > mplayer.hg
comparison stream/realrtsp/xbuffer.c @ 29263:0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
author | diego |
---|---|
date | Wed, 13 May 2009 02:58:57 +0000 |
parents | 64d82a45a05d |
children | ce0122361a39 |
comparison
equal
deleted
inserted
replaced
29262:7d545a6b8aff | 29263:0f1b5b68af32 |
---|---|
1 /* | 1 /* |
2 * xbuffer code | 2 * xbuffer code |
3 * | 3 * |
4 * Includes a minimalistic replacement for xine_buffer functions used in | 4 * Includes a minimalistic replacement for xine_buffer functions used in |
5 * Real streaming code. Only function needed by this code are implemented. | 5 * Real streaming code. Only function needed by this code are implemented. |
6 * | 6 * |
26 | 26 |
27 #define XBUFFER_HEADER_SIZE sizeof (xbuffer_header_t) | 27 #define XBUFFER_HEADER_SIZE sizeof (xbuffer_header_t) |
28 | 28 |
29 | 29 |
30 | 30 |
31 void *xbuffer_init(int chunk_size) { | 31 void *xbuffer_init(int chunk_size) { |
32 uint8_t *data=calloc(1,chunk_size+XBUFFER_HEADER_SIZE); | 32 uint8_t *data=calloc(1,chunk_size+XBUFFER_HEADER_SIZE); |
33 | 33 |
34 xbuffer_header_t *header=(xbuffer_header_t*)data; | 34 xbuffer_header_t *header=(xbuffer_header_t*)data; |
35 | 35 |
36 header->size=chunk_size; | 36 header->size=chunk_size; |
73 if (!buf) { | 73 if (!buf) { |
74 return 0; | 74 return 0; |
75 } | 75 } |
76 | 76 |
77 xbuf = ((xbuffer_header_t*)(((uint8_t*)buf)-XBUFFER_HEADER_SIZE)); | 77 xbuf = ((xbuffer_header_t*)(((uint8_t*)buf)-XBUFFER_HEADER_SIZE)); |
78 | 78 |
79 if (xbuf->size < size) { | 79 if (xbuf->size < size) { |
80 new_size = size + xbuf->chunk_size - (size % xbuf->chunk_size); | 80 new_size = size + xbuf->chunk_size - (size % xbuf->chunk_size); |
81 xbuf->size = new_size; | 81 xbuf->size = new_size; |
82 buf = ((uint8_t*)realloc(((uint8_t*)buf)-XBUFFER_HEADER_SIZE, | 82 buf = ((uint8_t*)realloc(((uint8_t*)buf)-XBUFFER_HEADER_SIZE, |
83 new_size+XBUFFER_HEADER_SIZE)) + XBUFFER_HEADER_SIZE; | 83 new_size+XBUFFER_HEADER_SIZE)) + XBUFFER_HEADER_SIZE; |