* commit '6516632967da5e6bd7d6136e8678f826669ed26e':
tests: Only run noproxy test if networking is enabled
fifo: K&R formatting cosmetics
Conflicts:
libavformat/Makefile
libavutil/fifo.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
... | ... |
@@ -454,11 +454,12 @@ OBJS-$(CONFIG_UDP_PROTOCOL) += udp.o |
454 | 454 |
|
455 | 455 |
SKIPHEADERS-$(CONFIG_FFRTMPCRYPT_PROTOCOL) += rtmpdh.h |
456 | 456 |
SKIPHEADERS-$(CONFIG_NETWORK) += network.h rtsp.h |
457 |
-TESTPROGS = noproxy \ |
|
458 |
- seek \ |
|
457 |
+TESTPROGS = seek \ |
|
459 | 458 |
srtp \ |
460 | 459 |
url \ |
461 | 460 |
|
461 |
+TESTPROGS-$(CONFIG_NETWORK) += noproxy |
|
462 |
+ |
|
462 | 463 |
TOOLS = aviocat \ |
463 | 464 |
ismindex \ |
464 | 465 |
pktdumper \ |
... | ... |
@@ -24,11 +24,11 @@ |
24 | 24 |
|
25 | 25 |
AVFifoBuffer *av_fifo_alloc(unsigned int size) |
26 | 26 |
{ |
27 |
- AVFifoBuffer *f= av_mallocz(sizeof(AVFifoBuffer)); |
|
27 |
+ AVFifoBuffer *f = av_mallocz(sizeof(AVFifoBuffer)); |
|
28 | 28 |
if (!f) |
29 | 29 |
return NULL; |
30 | 30 |
f->buffer = av_malloc(size); |
31 |
- f->end = f->buffer + size; |
|
31 |
+ f->end = f->buffer + size; |
|
32 | 32 |
av_fifo_reset(f); |
33 | 33 |
if (!f->buffer) |
34 | 34 |
av_freep(&f); |
... | ... |
@@ -64,7 +64,7 @@ int av_fifo_realloc2(AVFifoBuffer *f, unsigned int new_size) |
64 | 64 |
unsigned int old_size = f->end - f->buffer; |
65 | 65 |
|
66 | 66 |
if (old_size < new_size) { |
67 |
- int len = av_fifo_size(f); |
|
67 |
+ int len = av_fifo_size(f); |
|
68 | 68 |
AVFifoBuffer *f2 = av_fifo_alloc(new_size); |
69 | 69 |
|
70 | 70 |
if (!f2) |
... | ... |
@@ -92,8 +92,10 @@ int av_fifo_grow(AVFifoBuffer *f, unsigned int size) |
92 | 92 |
return 0; |
93 | 93 |
} |
94 | 94 |
|
95 |
-// src must NOT be const as it can be a context for func that may need updating (like a pointer or byte counter) |
|
96 |
-int av_fifo_generic_write(AVFifoBuffer *f, void *src, int size, int (*func)(void*, void*, int)) |
|
95 |
+/* src must NOT be const as it can be a context for func that may need |
|
96 |
+ * updating (like a pointer or byte counter) */ |
|
97 |
+int av_fifo_generic_write(AVFifoBuffer *f, void *src, int size, |
|
98 |
+ int (*func)(void *, void *, int)) |
|
97 | 99 |
{ |
98 | 100 |
int total = size; |
99 | 101 |
uint32_t wndx= f->wndx; |
... | ... |
@@ -106,30 +108,31 @@ int av_fifo_generic_write(AVFifoBuffer *f, void *src, int size, int (*func)(void |
106 | 106 |
break; |
107 | 107 |
} else { |
108 | 108 |
memcpy(wptr, src, len); |
109 |
- src = (uint8_t*)src + len; |
|
109 |
+ src = (uint8_t *)src + len; |
|
110 | 110 |
} |
111 | 111 |
// Write memory barrier needed for SMP here in theory |
112 | 112 |
wptr += len; |
113 | 113 |
if (wptr >= f->end) |
114 | 114 |
wptr = f->buffer; |
115 |
- wndx += len; |
|
116 |
- size -= len; |
|
115 |
+ wndx += len; |
|
116 |
+ size -= len; |
|
117 | 117 |
} while (size > 0); |
118 | 118 |
f->wndx= wndx; |
119 | 119 |
f->wptr= wptr; |
120 | 120 |
return total - size; |
121 | 121 |
} |
122 | 122 |
|
123 |
- |
|
124 |
-int av_fifo_generic_read(AVFifoBuffer *f, void *dest, int buf_size, void (*func)(void*, void*, int)) |
|
123 |
+int av_fifo_generic_read(AVFifoBuffer *f, void *dest, int buf_size, |
|
124 |
+ void (*func)(void *, void *, int)) |
|
125 | 125 |
{ |
126 | 126 |
// Read memory barrier needed for SMP here in theory |
127 | 127 |
do { |
128 | 128 |
int len = FFMIN(f->end - f->rptr, buf_size); |
129 |
- if(func) func(dest, f->rptr, len); |
|
130 |
- else{ |
|
129 |
+ if (func) |
|
130 |
+ func(dest, f->rptr, len); |
|
131 |
+ else { |
|
131 | 132 |
memcpy(dest, f->rptr, len); |
132 |
- dest = (uint8_t*)dest + len; |
|
133 |
+ dest = (uint8_t *)dest + len; |
|
133 | 134 |
} |
134 | 135 |
// memory barrier needed for SMP here in theory |
135 | 136 |
av_fifo_drain(f, len); |
... | ... |
@@ -160,9 +163,9 @@ int main(void) |
160 | 160 |
av_fifo_generic_write(fifo, &i, sizeof(int), NULL); |
161 | 161 |
|
162 | 162 |
/* peek at FIFO */ |
163 |
- n = av_fifo_size(fifo)/sizeof(int); |
|
164 |
- for (i = -n+1; i < n; i++) { |
|
165 |
- int *v = (int *)av_fifo_peek2(fifo, i*sizeof(int)); |
|
163 |
+ n = av_fifo_size(fifo) / sizeof(int); |
|
164 |
+ for (i = -n + 1; i < n; i++) { |
|
165 |
+ int *v = (int *)av_fifo_peek2(fifo, i * sizeof(int)); |
|
166 | 166 |
printf("%d: %d\n", i, *v); |
167 | 167 |
} |
168 | 168 |
printf("\n"); |
... | ... |
@@ -1,14 +1,14 @@ |
1 |
-FATE_LIBAVFORMAT += fate-noproxy |
|
1 |
+FATE_LIBAVFORMAT-$(CONFIG_NETWORK) += fate-noproxy |
|
2 | 2 |
fate-noproxy: libavformat/noproxy-test$(EXESUF) |
3 | 3 |
fate-noproxy: CMD = run libavformat/noproxy-test |
4 | 4 |
|
5 |
-FATE_LIBAVFORMAT += fate-srtp |
|
5 |
+FATE_LIBAVFORMAT-yes += fate-srtp |
|
6 | 6 |
fate-srtp: libavformat/srtp-test$(EXESUF) |
7 | 7 |
fate-srtp: CMD = run libavformat/srtp-test |
8 | 8 |
|
9 |
-FATE_LIBAVFORMAT += fate-url |
|
9 |
+FATE_LIBAVFORMAT-yes += fate-url |
|
10 | 10 |
fate-url: libavformat/url-test$(EXESUF) |
11 | 11 |
fate-url: CMD = run libavformat/url-test |
12 | 12 |
|
13 |
-FATE-$(CONFIG_AVFORMAT) += $(FATE_LIBAVFORMAT) |
|
13 |
+FATE-$(CONFIG_AVFORMAT) += $(FATE_LIBAVFORMAT-yes) |
|
14 | 14 |
fate-libavformat: $(FATE_LIBAVFORMAT) |